home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Cool Extras! / WallBall Screen Saver / WallBall.dxr / 00015_E's Btn Behavior.ls < prev    next >
Encoding:
Text File  |  1999-11-11  |  3.7 KB  |  139 lines

  1. property myUpState, myRollState, myDnState, myS, myHandler, myType, mySystemcursor, myBitmapCursor, myBitmapCursorMask
  2.  
  3. on beginSprite me
  4.   theMember = sprite(the currentSpriteNum).member
  5.   theMemberNumber = theMember.number
  6.   me.myUpState = member(theMemberNumber)
  7.   me.myRollState = member(theMemberNumber + 1)
  8.   me.myDnState = member(theMemberNumber + 2)
  9.   me.myS = the currentSpriteNum
  10.   me.myHandler = sprite(the currentSpriteNum).member.name
  11. end
  12.  
  13. on mouseEnter me
  14.   if rollOver(me.myS) <> 1 then
  15.     exit
  16.   end if
  17.   sprite(me.myS).member = me.myRollState
  18.   if me.myBitmapCursor = EMPTY then
  19.     sprite(me.myS).cursor = me.mySystemcursor
  20.   else
  21.     sprite(me.myS).cursor = [the number of member value(the myBitmapCursor of me), the number of member value(the myBitmapCursorMask of me)]
  22.   end if
  23.   updateStage()
  24. end
  25.  
  26. on mouseLeave me
  27.   sprite(me.myS).member = me.myUpState
  28.   sprite(me.myS).cursor = 0
  29.   updateStage()
  30. end
  31.  
  32. on mouseDown me
  33.   global gNavTracker2
  34.   whichSprite = myS
  35.   actNow = 1
  36.   dnClick = "click1"
  37.   upClick = "click2"
  38.   playedSNDFX = 0
  39.   puppetSound(3, dnClick)
  40.   playedSNDFX = 1
  41.   set the member of sprite whichSprite to myDnState
  42.   updateStage()
  43.   actNow = 1
  44.   if not (the stillDown) then
  45.     wait(3)
  46.   end if
  47.   repeat while the stillDown
  48.     if rollOver(whichSprite) then
  49.       if not playedSNDFX then
  50.         puppetSound(3, dnClick)
  51.         set the member of sprite whichSprite to myDnState
  52.         playedSNDFX = 1
  53.         actNow = 1
  54.       end if
  55.     else
  56.       if playedSNDFX then
  57.         puppetSound(3, upClick)
  58.         set the member of sprite whichSprite to myUpState
  59.         playedSNDFX = 0
  60.         actNow = 0
  61.       end if
  62.     end if
  63.     updateStage()
  64.   end repeat
  65.   if the member of sprite whichSprite = myDnState then
  66.     set the member of sprite whichSprite to myUpState
  67.     puppetSound(3, upClick)
  68.   end if
  69.   updateStage()
  70.   repeat while soundBusy(3)
  71.     updateStage()
  72.   end repeat
  73.   puppetSound(3, 0)
  74.   gNavTracker2 = VOID
  75.   if actNow = 1 then
  76.     do(myHandler)
  77.   end if
  78. end
  79.  
  80. on simBtnObj me
  81.   if me.myType = "chk" then
  82.     if me.myOnOff then
  83.       puppetSound(3, "click1")
  84.       set the member of sprite the myS of me to me.myOnDnstate
  85.       updateStage()
  86.       wait(15)
  87.       puppetSound(3, "click2")
  88.       set the member of sprite the myS of me to me.myOnUpstate
  89.       updateStage()
  90.       me.myOnOff = 0
  91.     else
  92.       puppetSound(3, "click1")
  93.       set the member of sprite the myS of me to me.myDnState
  94.       updateStage()
  95.       wait(15)
  96.       puppetSound(3, "click2")
  97.       set the member of sprite the myS of me to me.myUpState
  98.       updateStage()
  99.       me.myOnOff = 1
  100.     end if
  101.   else
  102.     puppetSound(3, "click1")
  103.     set the member of sprite the myS of me to me.myDnState
  104.     updateStage()
  105.     wait(15)
  106.     puppetSound(3, "click2")
  107.     set the member of sprite the myS of me to me.myUpState
  108.     updateStage()
  109.   end if
  110.   do(myHandler)
  111. end
  112.  
  113. on getPropertyDescriptionList
  114.   if the currentSpriteNum = 0 then
  115.     exit
  116.   end if
  117.   theMember = sprite(the currentSpriteNum).member
  118.   theMemberNumber = theMember.number
  119.   if sprite(the currentSpriteNum).member.type = #graphic then
  120.     castFormatType = #bitmap
  121.   else
  122.     if sprite(the currentSpriteNum).member.type = #bitmap then
  123.       castFormatType = #bitmap
  124.     else
  125.       if sprite(the currentSpriteNum).member.type = #shape then
  126.         castFormatType = #shape
  127.       else
  128.         castFormatType = [#graphic, #text]
  129.       end if
  130.     end if
  131.   end if
  132.   p_list = [#mySystemcursor: [#comment: "my system cursor:", #format: #cursor, #default: 280], #myBitmapCursor: [#comment: "Mac Color Cursor or Cursor:", #format: [#bitmap, #cursor], #default: EMPTY], #myBitmapCursorMask: [#comment: "PC Color Cursor or Cursor Mask:", #format: [#bitmap, #cursor], #default: EMPTY]]
  133.   return p_list
  134. end
  135.  
  136. on getBehaviorDescription
  137.   return "new button handler"
  138. end
  139.